//
//  NewMeView.m
//  7.13苏宁框架
//
//  Created by app01 on 15/7/22.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "NewMeView.h"
#import "Common.h"

@interface NewMeView ()<UITextFieldDelegate>

{
    BOOL flag;
}

@end
@implementation NewMeView

-(instancetype)init{
    return [[NSBundle mainBundle]loadNibNamed:@"NewMeView" owner:self options:nil][0];
}



-(void)awakeFromNib{
    
     _selectedBtn = _myShowBtn;
    _editName.layer.borderColor = [UIColor lightGrayColor].CGColor;
    _editName.layer.borderWidth = 1;
    _editName.delegate = self;
    _editName.hidden = YES;
    
    
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    int care = [[defaults objectForKey:@"care"] integerValue];
    _careLabel.text = [NSString stringWithFormat:@"%d",care];
    
    _editName.text = [defaults objectForKey:@"sign"];
    if (_editName.text.length>0) {
        _editBtn.hidden = YES;
        _editName.hidden = NO;
    }
    
}



- (void)textFieldDidEndEditing:(UITextField *)textField{
    if ([self.delegate respondsToSelector:@selector(saveSign:)]) {
        [self.delegate saveSign:textField];
    }
}


- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    if ([self.delegate respondsToSelector:@selector(clickTextFiled:)]) {
        [self.delegate clickTextFiled:textField];
    }
    return YES;
}



- (IBAction)clickBtnAction:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickAction:)]) {
        [self.delegate clickAction:sender];
    }
    
}

- (IBAction)editAction:(id)sender {
    if (!flag) {
        _editName.hidden = NO;
        _editBtn.hidden = YES;
        flag = 0;
        return;
    }else{
        _editBtn.hidden = NO;
        _editName.hidden = YES;

    }
}

- (IBAction)zanTap:(id)sender {
}

- (IBAction)careTap:(id)sender {
}

- (IBAction)fansTap:(id)sender {
}
@end
